const express = require('express');
const router = express.Router();
//
const ipController = require('../controllers/ipController.js');
const rateLimit = require("express-rate-limit");
const limiter = rateLimit({
	windowMs: 60 * 1000,
	max: 20,
	message: '请求过于频繁，请稍后再试。'
});
router.use(limiter);
//获取ip信息
router.get('/getIpInfo', (req, res, next) => {
	ipController.getIpInfo(req, res);
})
//精确获取ip信息
router.get('/getIpInfoPlus', (req, res, next) => {
	ipController.getIpInfoPlus(req, res);
})
//关键词搜索
router.get('/suggestion', (req, res, next) => {
	ipController.suggestion(req, res);
})
 //获取路线规划
router.get('/getRoutePlanning', (req, res, next) => {
	ipController.getRoutePlanning(req, res);
})
//获取附近门店
router.get('/getStoresList', (req, res, next) => {
	ipController.getStoresList(req, res);
})
//根据经纬度查询门店
router.get('/getStores', (req, res, next) => {
	ipController.getStores(req, res);
})
module.exports = router;